﻿<%@ Control Language="VB" AutoEventWireup="false" CodeFile="Section11.ascx.vb" Inherits="Control_MSDS_Section11" %>
<style type="text/css">
	textarea {
		height: 100%!important;
		width: 99.6%;
	}
</style>

<script type="text/javascript">
	function ajaxJquery() {
		$(function () {
			$(".TextBox:first").focus();
			$("[id*=btnAdd1]").click(function () {
				AddNewRow('', '', '', '', '');
			});
			if ("<%=hidID.Value%>" * 1 > 0) {
				//'' Thực hiện Ajax lấy data Detail
				$.ajax({
					url: '<%=ResolveUrl("~/Services/wsAutoComplete.asmx/GetDataSection11Detail")%>',
					data: "{ 'strSection11ID': '" + <%= hidID.Value%> + "'}",
					dataType: "json",
					type: "POST",
					contentType: "application/json; charset=utf-8",
					beforeSend: function () {
						$("#[id*=UpdateProgress1]").css({ 'display': 'block' });
					},
					success: function (data) {
						try {
							$.each(data.d.split("$"), function (idx, obj) {
								var _tempValue = obj.split("#");
								if (_tempValue.length > 4) {
									AddNewRow(_tempValue[0], _tempValue[1], _tempValue[2], _tempValue[3], _tempValue[4]);
								}
							});
							$("#[id*=UpdateProgress1]").css({ 'display': 'none' });
						} catch (e) { $("#[id*=UpdateProgress1]").css({ 'display': 'none' }); }
					},
					error: function (XMLHttpRequest, textStatus, errorThrown) {
						//Alertbox(textStatus);
						$("#[id*=UpdateProgress1]").css({ 'display': 'none' });
					}
				});
			} else {
				$("[id*=btnAdd1]").click();
			}
		});
	}

	// Xoa dong
	function RemoveRow(obj) {
		$(obj).closest("tr").fadeOut(500, function () {
			$(this).remove();
		});
		return false;
	}

	function AddNewRow(_tp, _ln, _kq, _dtx, _svt) {
		var index = 0;
		index = Math.floor(Math.random() * 100);
		var _html = "<tr  id='" + index + "' >"
						+ "<td width='5%' class='text_list_links' align='center'><a  class='delbutton' style='cursor:pointer;' onclick=\"RemoveRow(this);\" > <%=hidDel.Value %> </a> </td>"
								+ "<td width='19%' class='text_list_links' align='center'>"
									+ "<textarea rows='4' id='txtThanhPhan" + index + "' class='ThanhPhan'>" + _tp + "</textarea>"
								+ "</td>"
								+ "<td width='19%' class='text_list_links' align='center'>"
									+ "<textarea rows='4' id='txtLoaiNguong" + index + "' class='LoaiNguong'>" + _ln + "</textarea>"
								+ "</td>"
								+ "<td width='19%' class='text_list_links' align='center'>"
									+ "<textarea rows='4' id='txtKetQua" + index + "' class='KetQua'>" + _kq + "</textarea>"
								+ "</td>"
								+ "<td width='19%' class='text_list_links' align='center'>"
									+ "<textarea rows='4' id='txtDuongTiepXuc" + index + "' class='DuongTiepXuc'>" + _dtx + "</textarea>"
								+ "</td>"
								+ "<td width='19%' class='text_list_links' align='center'>"
									+ "<textarea rows='4' id='txtSinhVatThu" + index + "' class='SinhVatThu'>" + _svt + "</textarea>"
								+ "</td>"
							+ "</tr>"
		$("#tb1").append(_html);
	}
	function SetValueForm() {
		var strValue = "";
		$(".BoxField table[@id^=tb1] tbody tr").each(function (e) {
			try {
				var _thanhPhan = $(this).find(".ThanhPhan").val().trim();
				var _loaiNguong = $(this).find(".LoaiNguong").val().trim();
				var _ketQua = $(this).find(".KetQua").val().trim();
				var _duongTiepSuc = $(this).find(".DuongTiepXuc").val().trim();
				var _sinhVatThu = $(this).find(".SinhVatThu").val().trim();
				if (_thanhPhan + _loaiNguong + _ketQua + _duongTiepSuc + _sinhVatThu != "")
					strValue += (_thanhPhan + "#" + _loaiNguong + "#" + _ketQua + "#" + _duongTiepSuc + "#" + _sinhVatThu) + "$";
			} catch (e) {
			}
		});
		$("#hidValue").val(strValue);
		return true;
	}
</script>
<asp:UpdatePanel ID="uplMsdssection11" runat="server">
	<ContentTemplate>
		<div style="clear: both; height: 20px"></div>
		<div class="BoxField">
			<div class="HeadTitle">
				<h3>
					<asp:Label ID="lbSection11Title" runat="server" Text="PHẦN XI. THÔNG TIN VỀ ĐỘC TÍNH" /></h3>
			</div>
			<div style="clear: both; padding-top: 10px;">
			</div>
			<div class="DivTable" style="display: none">
				<div class="DivTableRow">
					<div class="DivTableHeader">
					</div>
					<div class="DivTableHeader">
					</div>
					<div class="DivTableHeader">
					</div>
					<div class="DivTableHeader">
					</div>
					<div class="DivTableHeader">
					</div>
				</div>
				<%-- Thanh phan 1--%>
				<div class="DivTableRow">
					<div class="DivTableColumn">
						<asp:Label ID="lblSection11Thanhphan1" CssClass="TextLabel" runat="server" Text="Thành phần 1" Visible="false"> </asp:Label>
						<asp:TextBox ID="txtS1110" CssClass="TextBoxSection" MaxLength="200" runat="server"></asp:TextBox>

					</div>
					<div class="DivTableColumn">
						<asp:TextBox ID="txtS1111" CssClass="TextBoxSection" MaxLength="200" runat="server"></asp:TextBox>
					</div>
					<div class="DivTableColumn">
						<asp:TextBox ID="txtS1112" CssClass="TextBoxSection" MaxLength="200" runat="server"></asp:TextBox>
					</div>
					<div class="DivTableColumn">
						<asp:TextBox ID="txtS1113" CssClass="TextBoxSection" MaxLength="200" runat="server"></asp:TextBox>
					</div>
					<div class="DivTableColumn">
						<asp:TextBox ID="txtS1114" CssClass="TextBoxSection" MaxLength="200" runat="server"></asp:TextBox>
					</div>
				</div>
				<%-- Thanh phan 2--%>
				<div class="DivTableRow">
					<div class="DivTableColumn">
						<asp:Label ID="lblSection11Thanhphan2" CssClass="TextLabel" runat="server" Text="Thành phần 2 (nếu có)" Visible="false"> </asp:Label>
						<asp:TextBox ID="txtS1120" CssClass="TextBoxSection" MaxLength="200" runat="server"></asp:TextBox>
					</div>
					<div class="DivTableColumn">
						<asp:TextBox ID="txtS1121" CssClass="TextBoxSection" MaxLength="200" runat="server"></asp:TextBox>
					</div>
					<div class="DivTableColumn">
						<asp:TextBox ID="txtS1122" CssClass="TextBoxSection" MaxLength="200" runat="server"></asp:TextBox>
					</div>
					<div class="DivTableColumn">
						<asp:TextBox ID="txtS1123" CssClass="TextBoxSection" MaxLength="200" runat="server"></asp:TextBox>
					</div>
					<div class="DivTableColumn">
						<asp:TextBox ID="txtS1124" CssClass="TextBoxSection" MaxLength="200" runat="server"></asp:TextBox>
					</div>
				</div>
				<%-- Thanh phan 3--%>
				<div class="DivTableRow">
					<div class="DivTableColumn">
						<asp:Label ID="lblSection11Thanhphan3" CssClass="TextLabel" runat="server" Text="Thành phần 3 (nếu có)" Visible="false"> </asp:Label>
						<asp:TextBox ID="txtS1130" CssClass="TextBoxSection" MaxLength="200" runat="server"></asp:TextBox>
					</div>
					<div class="DivTableColumn">
						<asp:TextBox ID="txtS1131" CssClass="TextBoxSection" MaxLength="200" runat="server"></asp:TextBox>
					</div>
					<div class="DivTableColumn">
						<asp:TextBox ID="txtS1132" CssClass="TextBoxSection" MaxLength="200" runat="server"></asp:TextBox>
					</div>
					<div class="DivTableColumn">
						<asp:TextBox ID="txtS1133" CssClass="TextBoxSection" MaxLength="200" runat="server"></asp:TextBox>
					</div>
					<div class="DivTableColumn">
						<asp:TextBox ID="txtS1134" CssClass="TextBoxSection" MaxLength="200" runat="server"></asp:TextBox>
					</div>
				</div>
			</div>
			<div class="DivRow" style="border-style: none;">
				<div style="clear: left; height: 10px">
				</div>
				<div style="width: 100%;" class="DivTextBox">
					<table id="tb1" cellpadding="0" width="99%" cellspacing="0" border="1" class="GridBorder">
						<thead>
							<tr align="center" style="height: 26px;" class="GridHeader">
								<td width='5%' class='text_list_links' align='center'></td>
								<td width='19%' class='text_list_links' align='center'>
									<asp:Label ID="lbSection11TenTP" runat="server" Text="Tên thành phần " />
								</td>
								<td width='19%' class='text_list_links' align='center'>
									<asp:Label ID="lbSection11LoaiNguong" runat="server" Text="Loại ngưỡng" />
								</td>
								<td width='19%' class='text_list_links' align='center'>
									<asp:Label ID="lbSection11KQ" runat="server" CssClass="TextLabel" Text="Kết quả" />
								</td>
								<td width='19%' class='text_list_links' align='center'>
									<asp:Label ID="lbSection11DuongTiepXuc" runat="server" Text="Đường tiếp xúc" />
								</td>
								<td width='19%' class='text_list_links' align='center'>
									<asp:Label ID="lbSection11SinhVatThu" runat="server" Text="Sinh vật thử" />
								</td>
							</tr>
						</thead>
					</table>
					<div style="clear: left; height: 10px">
					</div>
					<input id="btnAdd1" runat="server" type="button" class="btn" value=" Thêm " data-tbname="tb1" />
				</div>
			</div>

			<div style="clear: both; padding-top: 10px;">
			</div>
			<div class="DivRow">
				<div class="DivLabel">
					<asp:Label ID="lbSection11lbCacAnhHuong" CssClass="TextLabel" runat="server" Text="1.Các ảnh hưởng mãn tính với người (Ung thư,độc sinh sản, biến đổi gen...)" />
				</div>
				<div class="DivTextBox">
					<asp:TextBox ID="txtS1141" CssClass="TextArea" runat="server" Text="" ClientIDMode="Static" Width="691px" TextMode="MultiLine" Rows="13"/>
				</div>
			</div>
			<div class="DivRow">
				<div class="DivLabel">
					<asp:Label ID="lbSection11lbAnhHuongDocKhac" CssClass="TextLabel" runat="server" Text="2.Các ảnh hưởng độc khác" />
				</div>
				<div class="DivTextBox">
					<asp:TextBox ID="txtS1151" CssClass="TextArea" runat="server" Text="" Rows="13" Width="691px" TextMode="MultiLine"  />
				</div>
			</div>
			<div style="clear: both; padding-top: 10px;">
			</div>
			<div class="DivRow">
				<div class="DivLabel">
					&nbsp;&nbsp;&nbsp;
				</div>
				<div class="DivTextBox">
					<div style="float: left">
						<asp:Button ID="btnSave" runat="server" Text=" Save - Next " CssClass="btn" OnClientClick="return SetValueForm();" />
						&nbsp;<asp:Button ID="btnPrevious" runat="server" CausesValidation="false" CssClass="btn"
							Text="Previous" />
					</div>
					<div style="float: right; text-align: right">
					</div>
				</div>
			</div>
			<div style="display: none">
				<asp:HiddenField ID="hidMSDSID" Value="0" runat="server" />
				<asp:HiddenField ID="hidID" Value="0" runat="server" />
				<asp:HiddenField ID="hidDel" Value=" Xóa " runat="server" ClientIDMode="Static" />
				<asp:HiddenField ID="hidValue" Value="" runat="server" ClientIDMode="Static" />
			</div>
		</div>
	</ContentTemplate>
</asp:UpdatePanel>

